<template>
  <div class="rightBodyContent">
    <div class="rightBodyContent-in">
    <!--本体列表，数据 -->
    <div class="table-body">
      <div class="table-body-box">
        <el-table
                ref="multipleTable"
                :data="arryList"
                :stripe="tableoption.tableStripe"
                :border="tableoption.tableBorder"
                tooltip-effect="dark"
                style="width: 100%">
          <el-table-column
                  prop="id"
                  label="序号"
                  width="50"
                  align="center">
          </el-table-column>
          <el-table-column
                  label="预约的区角"
                  align="center">
            <template slot-scope="scope">
              <div class="dishimgForBox">
                <img :src="item.pic" alt="" v-for="item in scope.row.corner_id" class="dishimgFor">
              </div>
            </template>
          </el-table-column>
          <el-table-column
                  prop="create_time"
                  label="发布时间"
                  width="240"
                  align="center">
          </el-table-column>

          <el-table-column
                  label="操作"
                  width="200"
                  align="center">
            <template slot-scope="scope">
              <el-button size="small" @click="handleEdit(scope.$index)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <!--工具条 分页-->
    <el-col :span="24" class="toolbar">
      <el-pagination
              background
              :page-size="page.pagesize"
              :current-page="page.pageindex"
              layout="total, prev, pager, next"
              :total="page.total"
              @current-change="handleSizeChange"></el-pagination>
    </el-col>
  </div>
  </div>
</template>

<script>
  import {pagination, tableoption, yeartime} from '@/utils/util.js'
  import api from '@/utils/api.js'

  export default {
    data () {
      return {
        tableoption: tableoption,
        page: {
          pageindex: pagination.pageIndex,
          pagesize: pagination.pageSize,
          total: pagination.total
        },
        arryList: []
      }
    },
    created () {
      this.InitFn()
    },
    methods: {
      // 初始化
      InitFn () {
        this.$post(api.admin_corner_open_index, {
          p: this.page.pageindex
        }).then((response) => {
          if (response.code === 0) {
            this.arryList = response.list.data
            this.page.total = response.list.total
          } else {
          }
        }).catch((err) => {
          console.log(err)
        })
      },
      handleEdit (index) {
        this.$router.push('/historyDetail?id=' + this.arryList[index].id)
      },
      // 分页
      handleSizeChange (val) {
        this.page.pageindex = val
        this.InitFn()
      }
    },
    mounted () {
    }
  }
</script>

